

sqoop import --help

# ads
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--delete-target-dir \
--query 'select id, product_id, material_id, group_id, ad_name, materail_url from ads where $CONDITIONS and 1 = 1;' \
--num-mappers 1 \
--target-dir 'hdfs://node101:8020/warehouse/kk/ads/2024-11-18' \
--fields-terminated-by '\001' \
--null-non-string '\\N' \
--null-string '\\N'


# ads_platform
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--delete-target-dir \
--query 'select id, ad_id, platform_id, create_time, cancel_time from ads_platform where $CONDITIONS and 1 = 1;' \
--num-mappers 1 \
--target-dir 'hdfs://node101:8020/warehouse/kk/ads_platform/2024-11-18' \
--fields-terminated-by '\001' \
--null-non-string '\\N' \
--null-string '\\N'


# platform_info
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--delete-target-dir \
--query 'select id, platform, platform_alias_zh from platform_info where $CONDITIONS and 1 = 1;' \
--num-mappers 1 \
--target-dir 'hdfs://node101:8020/warehouse/kk/platform_info/2024-11-18' \
--fields-terminated-by '\001' \
--null-non-string '\\N' \
--null-string '\\N'


# product
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--delete-target-dir \
--query 'select id, name, price from product where $CONDITIONS and 1 = 1;' \
--num-mappers 1 \
--target-dir 'hdfs://node101:8020/warehouse/kk/product/2024-11-18' \
--fields-terminated-by '\001' \
--null-non-string '\\N' \
--null-string '\\N'






